import request from "@/utils/request-unimall";
import Qs from "qs";



export function listProduct(query) {
  return request({
    method: "get",
    url: "/web/admin-group-shop-ad/page",
    params: {
      // _gp: 'admin.product',
      // _mt: 'list',
      ...query
    }
  });
}

export function editProduct(data) {
  return request({
    method: "post",
    url: "/web/admin-group-shop-ad/edit",
    data
    // data: Qs.stringify({
    //   // _gp: 'admin.product',
    //   // _mt: 'edit',
    //   spuDTO: JSON.stringify(data)
    // })
  });
}

export function deleteProduct(id) {
  return request({
    method: "post",
    url: "/web/admin-group-shop-ad/delete",
    params: {
      // _gp: 'admin.product',
      // _mt: 'delete',
      spuId: id
    }
  });
}

export function batchDeleteProduct(ids) {
  return request({
    method: "post",
    url: "/web/admin-group-shop-ad/batch-delete",
    data: Qs.stringify({
      // _gp: 'admin.product',
      // _mt: 'batchDelete',
      ids: JSON.stringify(ids)
    })
  });
}

export function createProduct(data) {
  return request({
    method: "post",
    url: "/web/admin-group-shop-ad/create",
    data
    // data: Qs.stringify({
    //   // _gp: 'admin.product',
    //   // _mt: 'create',
    //   spuDTO: JSON.stringify(data)
    // })
  });
}

export function detailProduct(id) {
  return request({
    method: "get",
    url: "/web/admin-group-shop-ad/detail",
    params: {
      // _gp: 'admin.product',
      // _mt: 'detail',
      groupShopAdId: id
    }
  });
}

export function freezeOrActivtion(id, status) {
  return request({
    method: "post",
    url: "/web/admin-group-shop-ad/freeze-or-activation",
    data: Qs.stringify({
      // _gp: 'admin.product',
      // _mt: 'freezeOrActivation',
      spuId: id,
      status: status
    })
  });
}
export function selectById(data = {}) {
  return request({
    method: "get",
    url: "/web/admin-group-shop-ad/detail",
    params: data
  });
}
